﻿using System;
using LiSA_Server.Base.NHibernate.Models;
using NHibernate.Mapping.ByCode.Conformist;

namespace LiSA_Service.Users.Models
{
    public class User : Entity
    {
        /// <summary>
        /// Gets or sets the email.
        /// </summary>
        public virtual string Email { get; set; }

        /// <summary>
        /// Gets or sets the UserName.
        /// </summary>
        public virtual string UserName { get; set; }

        /// <summary>
        /// Gets or sets the encrypted password.
        /// </summary>
        public virtual string EncryptedPassword { get; set; }

        /// <summary>
        /// Indicates whether or not the user is listed as active in the system
        /// </summary>
        public virtual bool IsActive { get; set; }

        /// <summary>
        /// ID of the Person belonging to the user
        /// </summary>
        public virtual Guid PersonID { get; set; }
    }

    /// <summary>
    /// The user mapping.
    /// </summary>
    public class UserMapping : ClassMapping<User>
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="UserMapping"/> class.
        /// </summary>
        public UserMapping()
        {
            this.Property(x => x.Email);
            this.Property(x => x.UserName);
            this.Property(x => x.EncryptedPassword);
            this.Property(x => x.IsActive);
            this.Property(x => x.PersonID);
        }
    }
}